import { request } from "@/utils/service"

function getMessageList(params: {}) {
  return request({
    url: '/chat/messageList',
    method: 'get',
    params
  })
}

// 群消息列表
function getGroupMsgList(params: {}) {
  return request({
    url: '/chat/groupMsgList',
    method: 'get',
    params
  })
}

function getWsUserList() {
  return request({
    url: '/chat/userList',
    method: 'get'
  })
}

// 群组列表
function getChatGroupList() {
  return request({
    url: '/chat/groupList',
    method: 'get'
  })
}

// 不在群里的用户列表
function getNotInGroupUserList(params: {}) {
  return request({
    url: '/chat/notInGroupUsers',
    method: 'get',
    params: params
  })
}

// 给群添加成员
function joinGroupMembers(params: {}) {
  return request({
    url: '/chat/joinGroupMembers',
    method: 'post',
    data: params
  })
}

// 创建新的群组
function createNewGroup(params: {}) {
  return request({
    url: '/chat/groupCreate',
    method: 'post',
    data: params
  })
}

// 根据群id，查出群信息以及成员列表
function findGroupUserListById(params: {}) {
  return request({
    url: '/chat/groupItemById',
    method: 'get',
    params: params
  })
}

export {
  getMessageList,
  getWsUserList,
  getChatGroupList,
  getGroupMsgList,
  getNotInGroupUserList,
  joinGroupMembers,
  createNewGroup,
  findGroupUserListById
}
